package com.heatup.apt.common.constants;

import com.heatup.apt.common.util.StringUtil;


/**
 * 订单相关常量
 * <P>File name : OrderContants.java </P>
 * <P>Author : fangxiaowen </P> 
 * <P>Date : 2016年8月24日 </P>
 */
public class OrderContants {
	
	/**
	 * 订单来源微信服务号
	 */
	public static final Integer ORDER_SOURCE_WECHAT = 10;
	
	/**
	 * 订单来源线下刷卡
	 */
	public static final Integer ORDER_SOURCE_POS = 20;
	
	
	/** 付款方式为VIP免费，金额为0 */
	public static final int PAY_TYPE_VIP = 2;

	/** 付款方式为在线微信支付 */
	public static final int PAY_TYPE_WECHAT = 1;

	/** 个人储值卡方式支付 */
	public static final int PAY_TYPE_PERSON_ACCOUNT = 2;

	/** 企业储值卡方式支付*/
	public static final int PAY_TYPE_COMPANY_ACCOUNT = 3;
	
	/** 微信+个人储值卡支付*/
	public static final int PAY_TYPE_PERSONAL_WECHAT_ACCOUNT = 4;
	
	/** 微信+企业支付 */
	public static final int PAY_TYPE_COMPANY_WECHAT_ACCOUNT = 5;
	
	/** pos 刷卡支付  */
	public static final int PAY_TYPE_POS_ACCOUNT = 6;
	
	/** 服务卡类型支付 :包括了年卡支付  */
	public static final int PAY_TYPE_SERVICE_CARD_ACCOUNT = 7;
	
	/**  餐券方式支付  */
	public static final int PAY_TYPE_MEAL_COUPON = 8;
	
	/** 餐券+个人储值卡支付 */
	public static final int PAY_TYPE_MEAL_COUPON_AND_PERSON_ACCOUNT = 9;
	
	public static final String PAY_TYPE_WECHAT_NAME="微信支付";
	
	public static final String PAY_TYPE_PERSON_ACCOUNT_NAME = "代金卡支付";
	
	public static final String PAY_TYPE_COMPANY_ACCOUNT_NAME = "企业支付";
	
	public static final String PAY_TYPE_POS_ACCOUNT_NAME = "刷卡支付";
	
	public static final String PAY_TYPE_SERVICE_CARD_ACCOUNT_NAME = "会员支付";
	
	public static final String PAY_TYPE_MEAL_COUPON_NAME = "餐券支付";
	
	/**原价 */
	public static final int PAY_PRICE_TYPE=1;
	
	/**会员价 */
	public static final int PAY_VIP_PRICE_TYPE=2;
	
	/**限购1人 */
	public static final int LIMIT_ORDER_PERSON_COUNT_ONE=1;
	
	/**多人 */
	public static final int LIMIT_ORDER_PERSON_COUNT_MANY=2;
	
	/** 订单状态*/
	public enum OrderStatus{
		NORMAL(1,"1","正常"),
		CANCEL(2,"2","取消"),
		WAIT(3,"3","排队"),
		FINISH(4,"4","完成");
		
		private int index;
		private String status;
		private String title;
		
		OrderStatus(int index,String status,String title){
			this.index = index;
			this.status = status;
			this.title = title;
	    }
		
		public static OrderStatus getOrderStatus(String status){
			if(StringUtil.isEmpty(status))
				return null;
			for(OrderStatus orderStatus : OrderContants.OrderStatus.values()){
				if(StringUtil.isEquals(orderStatus.getStatus(), status)){
					return orderStatus;
				}
			}
			return null;
		}

		public int getIndex() {
			return index;
		}

		public void setIndex(int index) {
			this.index = index;
		}
		
		public String getStatus() {
			return status;
		}

		public void setStatus(String status) {
			this.status = status;
		}

		public String getTitle() {
			return title;
		}

		public void setTitle(String title) {
			this.title = title;
		}
	}
	
	/** 付款状态*/
	public static class PayStatus{
		/** 已付款 */
		public static final String PAID = "1";
		/** 未付款 */
		public static final String UNPAID = "2";
		/** 付款中 */
		public static final String PAEING = "3";
		/** 已退款 */
		public static final String REFOUND = "4";
		/** 部分退款 */
		public static final String PARTIAL_REFUND = "5";
	}

	/** 密码状态*/
	public static class PWDStatus{
		/**
		 * 有效(未使用)
		 */
		public static final String IS_VALID = "1";
		/**
		 * 无效(已使用)
		 */
		public static final String NOT_VALID = "0";
	}

	
	public enum OrderType {
		team_course(1,"1","团课订单"),
		pt(2,"2","私教订单"),
		fun_camp(3,"3","训练营订单"),
		selffit(4,"4","自助健身订单"),
		vip_order(5,"5","VIP订单"),
		user_account(6,"6","代金卡订单"),
		monthly_card(7,"7","包月卡订单"),
		goods_order(8,"8","商品订单订单"),// 商品订单的订单类型不用再orderInfo这张表中 ，商品订单是在goodsOrderInfo 表中
		physical_examination(9,"9","体测订单"),
		secret_experience(10,"10","私教体验订单"), 
		private_bespeak(11,"11","预约私教订单"),
		meal(12,"12","订餐订单"),
		mealCoupon(13,"13","餐券订单");


		
		private int index;
		private String type;
		private String title;
		
		OrderType(int index,String type,String title){
			this.index = index;
			this.type = type;
			this.title = title;
	    }
		
		public static OrderType getOrderType(String type){
			if(StringUtil.isEmpty(type))
				return null;
			for(OrderType OrderType : OrderContants.OrderType.values()){
				if(StringUtil.isEquals(OrderType.getType(), type)){
					return OrderType;
				}
			}
			return null;
		}

		public int getIndex() {
			return index;
		}

		public void setIndex(int index) {
			this.index = index;
		}

		public String getType() {
			return type;
		}

		public void setType(String type) {
			this.type = type;
		}

		public String getTitle() {
			return title;
		}

		public void setTitle(String title) {
			this.title = title;
		}
	}
	
	/** 订单来源 */
	public enum OrderSource{
		
		wechat(1,"10","微信"),
		person_account(2,"10","储值卡"),
		company_account(3,"10","企业"),
		personal_wechat_account(4,"10","微信+储值卡"),
		company_wechat_account(5,"10","微信+企业"),
		pos_account(6,"20","刷卡"),
		service_card_account(7,"10","储值卡");
		
		private Integer index;
		private String type;
		private String name;
		
		
		
		private OrderSource(Integer index, String type, String name) {
			this.index = index;
			this.type = type;
			this.name = name;
		}
		
		public static OrderSource getOrderSource(Integer index) {
			for(OrderSource os : OrderContants.OrderSource.values()) {
				if(os.index == index) {
					return os;
				}
			}
			return  OrderContants.OrderSource.wechat;
		}
		
		public Integer getIndex() {
			return index;
		}
		public void setIndex(Integer index) {
			this.index = index;
		}
		public String getType() {
			return type;
		}
		public void setType(String type) {
			this.type = type;
		}
		public String getName() {
			return name;
		}
		public void setName(String name) {
			this.name = name;
		}
		
		
		
	}

	/** 订单来源 */
	public enum PayType{

		wechat_pay(1,"1","微信支付"),
		person_account_pay(2,"2","代金卡支付"),
		company_account_pay(3,"3","企业支付"),
		personal_wechat_account_pay(4,"4","微信+储值卡支付"),
		company_wechat_account_pay(5,"5","微信+企业支付"),
		pos_account_pay(6,"6","刷卡支付");

		private Integer index;
		private String type;
		private String name;



		private PayType(Integer index, String type, String name) {
			this.index = index;
			this.type = type;
			this.name = name;
		}

		public static PayType getPayType(Integer index) {
			for(PayType os : OrderContants.PayType.values()) {
				if(os.index == index) {
					return os;
				}
			}
			return  PayType.wechat_pay;
		}

		public Integer getIndex() {
			return index;
		}
		public void setIndex(Integer index) {
			this.index = index;
		}
		public String getType() {
			return type;
		}
		public void setType(String type) {
			this.type = type;
		}
		public String getName() {
			return name;
		}
		public void setName(String name) {
			this.name = name;
		}



	}
}
